<?php

class Habilitacoes_M extends I_Model {

    protected $_table_name = 'habilitacoes';
    protected $_primary_key = 'ID';
    protected $_primary_filter = 'intval';
    protected $_order_by = 'ID';
    protected $_direction = 'DESC';
    public $rules = array();
    protected $_timestamps = FALSE;

    public function __construct() {
        parent::__construct();
    }

    
    function delete_by($where){
    	return $this->db->delete($this->_table_name,$where);
    }
    
    
    function get_user_info($id){
        
        
        $this->db->select('le.TITLE,cm.NOME_FANTASIA,hb.*')
                  ->from('habilitacoes as hb')
                  ->join('leiloes as le','hb.LEILAO_ID=le.ID')
                  ->join('comitentes as cm','cm.ID=le.COMITENTE_ID')
                  ->where('hb.USER_ID',$id);
            $q = $this->db->get();
          return $q->result();
    }


    public function delete_all_leilao($id){

       return  $this->db->delete($this->_table_name,array('LEILAO_ID'=>$id));

  }
}
